<template>
  <div id="goodsActivitySearch">
    <div class="search-box">
      <el-form ref="ruleForm" :inline="true" :model="formInline">
        <el-form-item label="活动名称" prop="name">
          <el-input
            v-model="formInline.name"
            placeholder="请输入关键词"
            clearable
            maxlength="40"
            show-word-limit
          ></el-input>
        </el-form-item>
        <el-form-item label="活动编号" prop="activityNum">
          <el-input
            v-model="formInline.activityNum"
            placeholder="请输入关键词"
            clearable
            maxlength="40"
            show-word-limit
          ></el-input>
        </el-form-item>
        <el-form-item label="活动类型" prop="activityType">
          <el-select
            v-model="formInline.activityType"
            placeholder="请选择活动类型"
            clearable
          >
            <el-option
              v-for="item in typeList"
              :key="item.dictValue"
              :label="item.dictLabel"
              :value="item.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="活动状态" prop="activityStatus">
          <el-select
            v-model="formInline.activityStatus"
            clearable
            placeholder="请选择活动状态"
          >
            <el-option
              v-for="item in statusList"
              :key="item.dictValue"
              :label="item.dictLabel"
              :value="item.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item class="s-btn">
          <el-button type="success" icon="el-icon-search" @click="toSearch">
            查询
          </el-button>
          <el-button type="success" plain @click="reset">
            重置
          </el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
import { sysNormalDisable } from '@utils/dictionariesFunc'
export default {
  data() {
    return {
      formInline: {
        name: '',
        activityNum: '',
        activityType: '',
        activityStatus: ''
      },
      typeList: [],
      statusList: []
    }
  },
  async mounted() {
    const [type, status] = await Promise.all([
      sysNormalDisable('activity_course_type', 'activity_course_type'),
      sysNormalDisable('activity_course_status', 'activity_course_status')
    ])
    this.typeList = type
    this.statusList = status
  },
  methods: {
    /* 搜索 */
    toSearch() {
      this.$emit('toSearch', this.formInline)
    },
    /* 重置 */
    reset() {
      this.$refs['ruleForm'].resetFields()
    }
  }
}
</script>
<style lang="less"></style>
